package com.study.seckill.web.api;

import com.study.seckill.service.CourseService;
import com.study.util.ResponseResult;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @ClassName: UpdateBuyCountRabbitmqHandler
 * @Author: wYin
 * @Date: 2022/3/12 16:29
 */
@RabbitListener(queues = "wYin-updateBuyCount-queue")
@Component
public class UpdateBuyCountRabbitmqHandler {
    @Autowired
    private CourseService courseService;

    @RabbitHandler
    public void receiving(String str){
        System.out.println("课程id是："+str);
        //根据传入课程id添加课程购买量
        //todo 检查与service-edu服务的返回值类型
        ResponseResult<Void> voidResponseResult = courseService.updateCourseBuyCount(str);

    }
}
